[WRONG BRANCH] fix(usage): bound incremental append reads - #278
Conversation
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Its title has been prefixed with |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughIncremental usage-log reads now use a bounded full read when appended data exceeds ChangesUsage-log bounded fallback
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized change bounds incremental reads while preserving the existing fallback behavior; no actionable merge-blocking risk remains at the current head after normal review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Motivation
maxReadBytes, violating the bounded-read contract and risking CPU/memory exhaustion on large append bursts.Description
readUsageEntriesIncrementally(src/usage/log.ts) that abandons the incremental path and falls back to a bounded full-tail read whensize - retained.coveredThroughBytes > maxReadBytes.tests/api-usage.test.tsthat verifies a large append burst triggers a bounded full read rather than an unbounded incremental parse.maxReadBytes.Testing
bun run typecheckcompleted successfully.bun run privacy:scancompleted and passed.bun test tests/api-usage.test.tscould not complete in this environment due to a runtime import error (zstdDecompressSyncnot found innode:zlib), so the new test was added but could not be exercised here; the failure appears environmental rather than related to the change.Codex Task
Summary by CodeRabbit